import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);

        long n = in.nextLong();

        //判断位数
        int cnt = cnt(n);

        if(cnt <= 3){
            System.out.println(n);
        }else{
            char[] s = Long.toString(n).toCharArray();

            int t1 = cnt % 3 == 0 ? cnt / 3 - 1 : cnt /3;
            char[] ret = new char[cnt + t1];

            long t = cnt % 3;

            int i = 0;int j = 0;
            for(;i < t;i++){
                ret[i] = s[j++];
            }
            if(i != 0)  ret[i++] = ',';

            int flat = 0;
            for(;j < s.length;j++){
                if(flat == 3){
                    flat = 0;
                    ret[i++] = ',';
                }
                ret[i++] = s[j];
                flat++;
            }

            for(int k = 0; k < ret.length;k++){
                if(ret[k] != ',')
                    System.out.print(ret[k] - '0');
                else
                    System.out.print(ret[k]);
            }

        }
    }

    private static int cnt(long n){
        int count = 1;
        while(n / 10 != 0){
            count++;
            n /= 10;
        }
        return count;
    }
}
class Solution{

    /**
     * 添加逗号
     * https://www.nowcoder.com/practice/f51c317e745649c0900996fd3f683aed?tpId=290&tqId=39934&ru=/exam/oj
     * @param args
     */
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);

        char[] ch = in.nextLine().toCharArray();

        int n = ch.length;
        for(int i = 0;i < n;i++){
            System.out.print(ch[i]);
            if((n - i - 1) % 3 == 0 && i != n-1 ){
                System.out.print(",");
            }
        }
    }

    /**
     * 青蛙跳台阶
     * https://www.nowcoder.com/practice/bfb2a2b3cdbd4bd6bba0d4dca69aa3f0?tpId=230&tqId=39749&ru=/exam/oj
     */
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        int a = 1,b = 1,c = 0;

        for(int i = 2;i<= n;i++){
            c = a + b;
            a = b;
            b = c;
        }

        if(n == 0 || n == 1)
            System.out.print(n);
        else
            System.out.print(c);
    }

    /**
     * 组成顺子
     *https://www.nowcoder.com/practice/762836f4d43d43ca9deb273b3de8e1f4?tpId=13&tqId=11198&ru=/exam/oj
     */
    public boolean IsContinuous1 (int[] numbers)
    {
        boolean[] hash = new boolean[14];

        int minVal = 14,maxVal = 0;

        for(int x : numbers)
        {
            if(x != 0)
            {

                if(hash[x]) return false;
                minVal = Math.min(x,minVal);
                maxVal = Math.max(maxVal,x);
                hash[x] = true;
            }
        }
        return maxVal - minVal <= 4;
    }

    public static boolean IsContinuous (int[] numbers)
    {
        Arrays.sort(numbers);
        int zero_num = 0,i = 0,j = 0,n = numbers.length;
        while(j < n) if(numbers[j++] == 0){
            i++;zero_num++;
        }
        for(;i < n - 1;i++){
            if(numbers[i]  == numbers[i+1] ||
                    numbers[i + 1] - numbers[i] - 1 > zero_num) return false;
            else
            {
                int t = numbers[i + 1] - numbers[i] - 1;
                while(t-- != 0) zero_num--;
            }

        }
        return true;
    }

    public static void main(String[] args) {
        Solution.IsContinuous(new int[]{1,2,3,4,5});
    }

}